@extends('public.home_base')
@section('title', '备案域名')

@section('content')
    <style>
        body {
            background: #f6f7f9;
        }
        .signIn_info {
            float: right;
            margin-right: 0;
        }
        .select_all, .select_item, #select-all {
            margin-right: 15px;
            margin-left: 10px;
        }

        .btn_jrs_aliyun, .btn_jrs_txyun, .btn_jrs_qt, .btn_jrs_ja, .btn_jrs_baidu, .btn_jrs_xibu,.btn_jrs_huawei {
            display: inline-block;
            padding: 0 10px;
        }

        .btn_jrs_aliyun:hover, .btn_jrs_txyun:hover, .btn_jrs_qt:hover, .btn_jrs_ja:hover, .btn_jrs_xibu:hover, .btn_jrs_baidu:hover,.btn_jrs_huawei:hover  {
            color: #fff !important;
        }

        .btn.btn_primary {
            margin-left: 20px;
        }
    </style>
    @parent
    <div class="domain-deal w1200 auto0">
        <div class="page-taoym">
            <div class="main">

                <div class="taoym-search">
                    <form action="{{url('domain')}}" id="queryForm" method="post">
                        {{csrf_field()}}
                        <div class="tabs-nav">
                            <ul class="tabs-ul">
                                <li class="@if(empty($provider))active @endif alls"><span class="icon"></span><a href="javascript:;" data-name=""
                                                                                                                 onclick="searchtab(this)">所有域名</a></li>
                                <li class="@if($provider=='阿里云')active @endif aliyun"><span class="icon"></span><a href="javascript:;" data-name="阿里云"
                                                                                                                   onclick="searchtab(this)">阿里云</a>
                                </li>
                                <li class="@if($provider=='腾讯云')active @endif tengxunyun"><span class="icon"></span><a href="javascript:;" data-name="腾讯云"
                                                                                                                       onclick="searchtab(this)">腾讯云</a>
                                </li>
                                <li class="@if($provider=='百度云')active @endif baiduyun"><span class="icon"></span><a href="javascript:;" data-name="百度云"
                                                                                                                     onclick="searchtab(this)">百度云</a>
                                </li>
                                <li class="@if($provider=='华为云')active @endif huaweiyun"><span class="icon"></span><a href="javascript:;" data-name="华为云"
                                                                                                                      onclick="searchtab(this)">华为云</a>
                                </li>
                                <li class="@if($provider=='西部数码')active @endif xibushuma"><span class="icon"></span><a href="javascript:;" data-name="西部数码"
                                                                                                                       onclick="searchtab(this)">西部数码</a>
                                </li>
                                <li class="@if($provider=='景安')active @endif jingan"><span class="icon"></span><a href="javascript:;" data-name="景安"
                                                                                                                  onclick="searchtab(this)">景安</a>
                                </li>
                                <li class="@if($provider=='美橙互联')active @endif meichenghulian"><span class="icon"></span><a href="javascript:;" data-name="美橙互联"
                                                                                                                            onclick="searchtab(this)">美橙互联</a>
                                </li>
                                <li class="@if($provider=='其他')active @endif qita"><span class="icon"></span><a href="javascript:;" data-name="其他"
                                                                                                                onclick="searchtab(this)">其他</a>
                                </li>
                            </ul>
                        </div>
                        <div class="search_hide">
                            <table>
                                <tr>
                                    <td align="right">域名：</td>
                                    <td class="fn-clear">
                                        <input type="text" name="keyword" id="keyword" placeholder="请输入 关键字">
                                    </td>
                                    <td align="right">性质：</td>
                                    <td>
                                        <select class="dropdown" data="select" name="icp_type" id="icp_type">
                                            <option value="" name="nature">全部</option>
                                            <option value="0" name="nature">无备案</option>
                                            <option value="1" name="nature">个人</option>
                                            <option value="2" name="nature">企业</option>
                                            <option value="3" name="nature">事业单位</option>
                                            <option value="4" name="nature">其他</option>
                                        </select>
                                    </td>
                                    <td align="right">接入商：</td>
                                    <td>
                                        <input type="hidden" id="sort" value="1">
                                        <select class="dropdown" name="provider" id="provider">
                                            <option value="">全部接入商</option>
                                            <option name="registrar" value="阿里云">阿里云</option>
                                            <option name="registrar" value="腾讯云">腾讯云</option>
                                            <option name="registrar" value="百度云">百度云</option>
                                            <option name="registrar" value="华为云">华为云</option>
                                            <option name="registrar" value="西部数码">西部数码</option>
                                            <option name="registrar" value="景安">景安</option>
                                            <option name="registrar" value="美橙互联">美橙互联</option>
                                            <option name="registrar" value="其他">其他</option>
                                        </select>
                                    </td>
                                    <td align="right">价格：</td>
                                    <td class="fn-clear">
                                        <input type="text" value="0" name="price_start" id="price_start" class=" num-text">
                                        <span class="division">-</span>
                                        <input type="text" value="" name="price_end" id="price_end" class="num-text">
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">排除：</td>
                                    <td>
                                        <input type="text" name="skip" id="skip" placeholder="请输入 排除关键字">
                                    </td>
                                    <td align="right">地区：</td>
                                    <td>
                                        <select class="dropdown" name="city" id="city">
                                            <option value="">全部地区</option>
                                            <option value="北京" name="record">北京</option>
                                            <option value="天津" name="record">天津</option>
                                            <option value="重庆" name="record">重庆</option>
                                            <option value="上海" name="record">上海</option>
                                            <option value="河北" name="record">河北</option>
                                            <option value="山西" name="record">山西</option>
                                            <option value="内蒙古" name="record">内蒙古</option>
                                            <option value="辽宁" name="record">辽宁</option>
                                            <option value="吉林" name="record">吉林</option>
                                            <option value="黑龙江" name="record">黑龙江</option>
                                            <option value="江苏" name="record">江苏</option>
                                            <option value="浙江" name="record">浙江</option>
                                            <option value="安徽" name="record">安徽</option>
                                            <option value="福建" name="record">福建</option>
                                            <option value="江西" name="record">江西</option>
                                            <option value="山东" name="record">山东</option>
                                            <option value="河南" name="record">河南</option>
                                            <option value="湖北" name="record">湖北</option>
                                            <option value="湖南" name="record">湖南</option>
                                            <option value="广东" name="record">广东</option>
                                            <option value="广西" name="record">广西</option>
                                            <option value="海南" name="record">海南</option>
                                            <option value="四川" name="record">四川</option>
                                            <option value="贵州" name="record">贵州</option>
                                            <option value="云南" name="record">云南</option>
                                            <option value="西藏" name="record">西藏</option>
                                            <option value="陕西" name="record">陕西</option>
                                            <option value="甘肃" name="record">甘肃</option>
                                            <option value="青海" name="record">青海</option>
                                            <option value="宁夏" name="record">宁夏</option>
                                            <option value="新疆" name="record">新疆</option>
                                        </select>
                                    </td>
                                    <td align="right">后缀：</td>
                                    <td>
                                        <select name="hz" class="dropdown">
                                            <option value="">全部后缀</option>
                                            <option value=".com">com</option>
                                            <option value=".net">net</option>
                                            <option value=".cn">cn</option>
                                            <option value=".cc">cc</option>
                                            <option value=".pw">pw</option>
                                            <option value=".top">top</option>
                                            <option value=".wang">wang</option>
                                            <option value=".me">me</option>
                                            <option value=".info">info</option>
                                            <option value=".biz">biz</option>
                                            <option value=".asia">asia</option>
                                            <option value=".org">org</option>
                                            <option value=".mobi">mobi</option>
                                            <option value=".ren">ren</option>
                                            <option value=".club">club</option>
                                            <option value=".co">co</option>
                                        </select>

                                    </td>
                                    <td align="right">长度：</td>
                                    <td class="fn-clear">
                                        <input type="text" value="1" name="length_start" id="length_start" class="num-text">
                                        <span class="division">-</span>
                                        <input type="text" value="" name="length_end" id="length_end" class="num-text">
                                    </td>
                                </tr>

                                <tr>
                                    <td class="operation" align="right" colspan="4" style="padding:18px 0!important;">
                                        <input id="queryBtn" type="submit" class="ui-btn btn_orange5" value="搜索">
                                        <input type="button" class="ui-btn btn_gray5 reset" value="重置"
                                               onclick="searchFormReset();">
                                    </td>
                                </tr>
                            </table>
                            <table class=" table_style">
                                <thead>
                                <tr>
                                    <th width="220" style="padding-left: 2px;">
                                        <label>
                                            <input type="checkbox" class="select_all">
                                            域名
                                        </label>
                                    </th>
                                    <th width="80">价格</th>
                                    <th width="90">
                                        <span class="sort_style" data-field="length">接入商<i class="def"></i></span>
                                    </th>
                                    <th width="60">
                                        <span class="sort_style" data-field="viewCount">地区<i class="def"></i></span>
                                    </th>
                                    <th width="60">
                                        <span class="sort_style" data-field="expireTime">性质<i class="def"></i></span>
                                    </th>
                                    <th width="230">
                                        <span class="sort_style" data-field="price">建站记录<i class="def"></i></span>
                                    </th>
                                    <th>注册时间</th>
                                    <th>到期时间</th>
                                    <th>安全检测</th>
                                    <th width="90" style="text-align: center">操作</th>
                                </tr>
                                </thead>
                                <tbody class="domain-list">
                                @forelse($domain as $item)
                                    <tr>
                                        <td><input type="checkbox" class="select_item" name="id" value="{{$item->id}}">
                                            <a href="{{url('domain?id=').$item->id}}">{{$item->domain}}</a></td>
                                        <td style="color: #fe7300;">￥{{$item->price}}</td>
                                        @if($item->provider === '阿里云')
                                            <td><a href="javascript:;" class="btn_jrs_aliyun"> {{$item->provider}}</a></td>
                                        @elseif($item->provider === '百度云')
                                            <td><a href="javascript:;" class="btn_jrs_baidu"> {{$item->provider}}</a></td>
                                        @elseif($item->provider === '西部数码')
                                            <td><a href="javascript:;" class="btn_jrs_xibu"> {{$item->provider}}</a></td>
                                        @elseif($item->provider === '腾讯云')
                                            <td><a href="javascript:;" class="btn_jrs_txyun"> {{$item->provider}}</a></td>
                                        @elseif($item->provider === '景安')
                                            <td><a href="javascript:;" class="btn_jrs_ja"> {{$item->provider}}</a></td>
                                        @elseif($item->provider === '华为云')
                                            <td><a href="javascript:;" class="btn_jrs_huawei"> {{$item->provider}}</a></td>
                                        @else
                                            <td><a href="javascript:;"
                                                   class="btn_jrs_qt"> {{@$item->provider?$item->provider:'其他'}}</a></td>
                                        @endif
                                        <td>{{$item->city}}</td>
                                        @if($item->icp_type === 0)
                                            <td>无</td>
                                        @elseif($item->icp_type===1)
                                            <td>个人</td>
                                        @elseif($item->icp_type===2)
                                            <td>企业</td>
                                        @elseif($item->icp_type===3)
                                            <td>事业单位</td>
                                        @else
                                            <td>其他</td>
                                        @endif
                                        <td style="color: #1d5af2;">{{$item->icp_name}}</td>
                                        <td>2019-09-30</td>
                                        <td>2021-09-30</td>
                                        <td>
                                            <a href="javascript:;" title="未拦截"> <img src="/static/image/qq.png"
                                                                                     height="20px"></a>
                                            <a href="javascript:;" title="未拦截"> <img src="/static/image/wx.png"
                                                                                     height="20px"></a>
                                            <a href="javascript:;" title="未拦截"> <img src="/static/image/360.png"
                                                                                     height="20px"></a>
                                        </td>
                                        <td><a href="{{url('domain?id=').$item->id}}" class="btn btn_primary"
                                               disabled="">购买</a></td>
                                    </tr>
                                @empty
                                    <tr><p>无数据</p></tr>

                                @endforelse
                                </tbody>
                                <tfoot>
                                <tr>
                                    <td colspan="2" style="display: none;">
                                        <label>
                                            <input type="checkbox" id="select-all">
                                            全选
                                        </label>
                                        &ensp;<a href="javascript:;" id="buy" class="btn btn_primary">批量购买</a>
                                    </td>
                                    <td colspan="10">
                                        <div style="text-align: right">
                                            每页&ensp;{{$domain->count() }}&ensp;条
                                            &ensp;&ensp;
                                            共&ensp;{{$domain->lastPage() }}&ensp;页
                                            <div class="pagination" style="display: inline-block;">
                                                @if($domain->currentPage()==1)
                                                    <span class=" btn-link">&lt;</span>
                                                @else
                                                    <a href="{{$domain->previousPageUrl().$query_str }}">&lt;</a>
                                                @endif
                                                <span class="current">{{$domain->currentPage()}}</span>
                                                @if($domain->hasMorePages())
                                                    <a href="{{$domain->nextPageUrl().$query_str}}">&gt;</a>
                                                @else
                                                    <span class="  btn-link">&gt;</span>
                                                @endif
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                </tfoot>
                            </table>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function () {

            $("#reset").on("click", function () {
                $("dt.quick a").removeClass("text_orange");
                $("select").find("option:first").prop("selected", true);
                $("input:text,[name=minPrice],[name=maxPrice]").val("");
                $("textarea").val("");
                $(":checkbox").prop("checked", false).filter("[name=suffix]").prop("checked", true);
            });
            $(".reset").on("click", function () {
                $("#queryForm")[0].reset();
                loadingPage();
            });

            $("dt.quick a").on("click", function () {
                $(this).addClass("text_orange").siblings("a").removeClass("text_orange");
                var quickMark = $(this).attr("href").replace("#", "");
                var type = quickMark.charAt(0);
                var length = 0;
                if (quickMark.length > 1) {
                    length = quickMark.charAt(1);
                }
                if ((type === 'n' || type === 'l' || type === 's' || type === 'm') && length > 0) {
                    $("select[name=lMin], select[name=lMax]").find("option[value=" + length + "]").prop("selected", true);
                } else {
                    $("select[name=lMin], select[name=lMax]").find("option:first").prop("selected", true);
                }
                $("#quick").find("option[value='" + quickMark + "']").prop("selected", true);
                loadingPage()
            });

            $("#queryBtn").on("click", function () {
                loadingPage();
            });

            $("#queryForm").on("submit", function () {
                loadingPage();
                return false;
            });

            $("#pageSize").on("change", loadingPage);

            loadingPage();
            bindSelectAll({
                all: ".suffix_all",
                item: ".suffix_item"
            });


            $("#export").on("click", function () {
                exportForm("queryForm", "/domain/buy/export");
            });

            $(".sort_style").on("click", function () {
                loadingPage();
            });

            $("#buy").on("click", function () {
                var params = $('#queryForm').serialize();
                $('.select_item:checked').each(function () {
                    params += "&id[]=" + $(this).val();
                });
                window.location.href = "plyminfo&" + params;

            });

            function GetQueryValue(queryName) {
                var query = decodeURI(window.location.search.substring(1));
                var vars = query.split("&");
                for (var i = 0; i < vars.length; i++) {
                    var pair = vars[i].split("=");
                    if (pair[0] == queryName) {
                        return pair[1];
                    }
                }
                return null;
            }

        });

        function searchtab(that) {
            var provider = $(that).data("name");
            if (provider == '阿里云') {
                $('.tabs-ul li').removeClass('active');
                $('.aliyun').addClass('active');
            } else if (provider == '腾讯云') {
                $('.tabs-ul li').removeClass('active');
                $('.tengxunyun').addClass('active');
            } else if (provider == '西部数码') {
                $('.tabs-ul li').removeClass('active');
                $('.xibushuma').addClass('active');
            } else if (provider == '百度云') {
                $('.tabs-ul li').removeClass('active');
                $('.baiduyun').addClass('active');
            } else if (provider == '景安') {
                $('.tabs-ul li').removeClass('active');
                $('.jingan').addClass('active');
            } else if (provider == '美橙互联') {
                $('.tabs-ul li').removeClass('active');
                $('.meichenghulian').addClass('active');
            } else if (provider == '华为云') {
                $('.tabs-ul li').removeClass('active');
                $('.huaweiyun').addClass('active');
            } else if (provider == '其他') {
                $('.tabs-ul li').removeClass('active');
                $('.qita').addClass('active');
            } else {
                $('.tabs-ul li').removeClass('active');
                $('.alls').addClass('active');
            }
            window.location.href = '{{url('domain?provider=')}}' + provider;
        }

        // function doAddDiySearch() {
        //     var param = $("#queryForm").serializeJson();
        //     $.ajax({
        //         type: "post",
        //         async: "true",
        //         url: "domain",
        //         dataType: "json",
        //         data: param,
        //         success: function (data) {
        //             //   console.log(data);return false;
        //             if (data.code == '1') {
        //                 layer.msg(data.msg);
        //             } else {
        //                 layer.msg(data.msg);
        //             }
        //         }
        //     });
        // }
    </script>
@endsection